#!/bin/bash

REMOTE_URL=$1



if [ "x$REMOTE_URL" == "x" ];then
	echo "project name is empty"
	exit
fi

PROJECT=`basename $REMOTE_URL`

if [ ! -d $PROJECT ];then
	git clone --mirror $REMOTE_URL
	cd $PROJECT
	git remote set-url --push origin http://gitlab.domain.com/root/$PROJECT
else
	cd $PROJECT
fi

git fetch -p origin
git push --mirror



###  Base configure after mirror action
## save local repository account
# git config --local credential.helper store


##  save global repository account
# git config --global credential.helper store

## execute git action after setting 

##  install gitlab-runner

##  configure CI/CD from gitlab

#  gitlab-runner register
